<?php

namespace App\Http\Controllers\OA;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Logic\LimitLogic;
use App\Http\Controllers\OATrait\OATrait;
use Illuminate\Http\Request;

class LimitController extends Controller
{
    use OATrait;
    public function getList(Request $request)
    {
        try{
           $list = (new LimitLogic())->getList();
           ret_json('ok','ok',$list);
        }catch (\Exception $e){
            ret_json('err',$e->getMessage());
        }
    }

    public function editLimit(Request $request)
    {
        try{
            $rules = [
                'id'=>'required|exists:limit',
                'limit_money'=>'required|numeric',
            ];

            $this->verify($request->all(),$rules);

            $result = (new LimitLogic())->editLimit($request->all());
            ret_json('ok','修改成功');
        }catch (\Exception $e){
            ret_json('err',$e->getMessage());
        }
    }
}
